[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "{{ cookiecutter.project_slug }}"
version = "{{ cookiecutter.version }}"
description = "{{ cookiecutter.project_description }}"
readme = "README.md"
{% if cookiecutter.author_name -%}
authors = [
    {name = "{{ cookiecutter.author_name }}"{% if cookiecutter.author_email %}, email = "{{ cookiecutter.author_email }}"{% endif %}}
]
{% endif -%}
license = {text = "MIT"}
requires-python = ">=3.10"
keywords = ["cli", "tool"]
classifiers = [
    "Development Status :: 4 - Beta",
    "Environment :: Console",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Utilities",
]

dependencies = [
{% if cookiecutter.cli_framework == "typer" -%}
    "typer[all]>=0.16.0",
{% elif cookiecutter.cli_framework == "click" -%}
    "click>=8.2.0",
{% endif -%}
{% if cookiecutter.use_rich == "yes" -%}
    "rich>=14.0.0",
{% endif -%}
{% if cookiecutter.use_config_files == "yes" and cookiecutter.config_format == "toml" -%}
    "tomli>=2.2.1; python_version<'3.11'",
{% elif cookiecutter.use_config_files == "yes" and cookiecutter.config_format == "yaml" -%}
    "PyYAML>=6.0.2",
{% endif -%}
{% if cookiecutter.use_logging == "yes" -%}
    "loguru>=0.7.0",
{% endif -%}
{% if cookiecutter.use_web_client == "yes" -%}
    "httpx>=0.25.0",
{% endif -%}
{% if cookiecutter.use_file_watching == "yes" -%}
    "watchdog>=4.0.0",
{% endif -%}
    "python-dotenv>=1.1.1",
]

{% if cookiecutter.use_testing == "yes" or cookiecutter.use_linting == "yes" or cookiecutter.use_pre_commit == "yes" -%}
[project.optional-dependencies]
{% if cookiecutter.use_testing == "yes" -%}
test = [
    "pytest>=8.0.0",
    "pytest-cov>=4.0.0",
{% if cookiecutter.use_async == "yes" -%}
    "pytest-asyncio>=0.23.0",
{% endif -%}
]
{% endif -%}

{% if cookiecutter.use_linting == "yes" -%}
dev = [
    "ruff>=0.8.0",
    "black>=25.1.0",
    "mypy>=1.16.1",
{% if cookiecutter.use_testing == "yes" -%}
    "pytest>=8.0.0",
    "pytest-cov>=4.0.0",
{% if cookiecutter.use_async == "yes" -%}
    "pytest-asyncio>=0.23.0",
{% endif -%}
{% endif -%}
{% if cookiecutter.use_pre_commit == "yes" -%}
    "pre-commit>=4.2.0",
{% endif -%}
]
{% endif -%}
{% endif -%}

[project.scripts]
{{ cookiecutter.project_slug }} = "{{ cookiecutter.project_slug }}.main:main"

{% if cookiecutter.package_manager == "uv" -%}
# UV configuration (if using UV)
[tool.uv]
dev-dependencies = [
{% if cookiecutter.use_testing == "yes" -%}
    "pytest>=8.0.0",
    "pytest-cov>=4.0.0",
{% if cookiecutter.use_async == "yes" -%}
    "pytest-asyncio>=0.23.0",
{% endif -%}
{% endif -%}
{% if cookiecutter.use_linting == "yes" -%}
    "ruff>=0.8.0",
    "black>=25.1.0",
    "mypy>=1.16.1",
{% endif -%}
{% if cookiecutter.use_pre_commit == "yes" -%}
    "pre-commit>=4.2.0",
{% endif -%}
]

{% elif cookiecutter.package_manager == "poetry" -%}
# Poetry configuration (if using Poetry)
[tool.poetry]
name = "{{ cookiecutter.project_slug }}"
version = "{{ cookiecutter.version }}"
description = "{{ cookiecutter.project_description }}"
{% if cookiecutter.author_name -%}
authors = ["{{ cookiecutter.author_name }}{% if cookiecutter.author_email %} <{{ cookiecutter.author_email }}>{% endif %}"]
{% endif -%}
readme = "README.md"
packages = [{include = "{{ cookiecutter.project_slug }}", from = "src"}]

[tool.poetry.dependencies]
python = "^3.10"
{% if cookiecutter.cli_framework == "typer" -%}
typer = {extras = ["all"], version = "^0.16.0"}
{% elif cookiecutter.cli_framework == "click" -%}
click = "^8.2.0"
{% endif -%}
{% if cookiecutter.use_rich == "yes" -%}
rich = "^14.0.0"
{% endif -%}
{% if cookiecutter.use_config_files == "yes" and cookiecutter.config_format == "toml" -%}
tomli = {version = "^2.2.1", markers = "python_version < '3.11'"}
{% elif cookiecutter.use_config_files == "yes" and cookiecutter.config_format == "yaml" -%}
PyYAML = "^6.0.2"
{% endif -%}
{% if cookiecutter.use_logging == "yes" -%}
loguru = "^0.7.0"
{% endif -%}
{% if cookiecutter.use_web_client == "yes" -%}
httpx = "^0.25.0"
{% endif -%}
{% if cookiecutter.use_file_watching == "yes" -%}
watchdog = "^4.0.0"
{% endif -%}
python-dotenv = "^1.1.1"

{% if cookiecutter.use_testing == "yes" or cookiecutter.use_linting == "yes" or cookiecutter.use_pre_commit == "yes" -%}
[tool.poetry.group.dev.dependencies]
{% if cookiecutter.use_testing == "yes" -%}
pytest = "^8.0.0"
pytest-cov = "^4.0.0"
{% if cookiecutter.use_async == "yes" -%}
pytest-asyncio = "^0.23.0"
{% endif -%}
{% endif -%}
{% if cookiecutter.use_linting == "yes" -%}
ruff = "^0.8.0"
black = "^25.1.0"
mypy = "^1.16.1"
{% endif -%}
{% if cookiecutter.use_pre_commit == "yes" -%}
pre-commit = "^4.2.0"
{% endif -%}
{% endif -%}

[tool.poetry.scripts]
{{ cookiecutter.project_slug }} = "{{ cookiecutter.project_slug }}.main:main"
{% endif -%}

{% if cookiecutter.use_linting == "yes" -%}
# Black formatting
[tool.black]
target-version = ["py310"]
line-length = 88
include = '\.pyi?$'

# Ruff linting
[tool.ruff]
target-version = "py310"
line-length = 88
select = [
    "E",  # pycodestyle errors
    "W",  # pycodestyle warnings
    "F",  # pyflakes
    "I",  # isort
    "B",  # flake8-bugbear
    "C4", # flake8-comprehensions
    "UP", # pyupgrade
]
ignore = [
    "E501", # line too long, handled by black
]

# MyPy type checking
[tool.mypy]
python_version = "3.10"
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
strict_equality = true
{% endif -%}

{% if cookiecutter.use_testing == "yes" -%}
# Pytest configuration
[tool.pytest.ini_options]
minversion = "8.0"
addopts = [
    "--cov=src/{{ cookiecutter.project_slug }}",
    "--cov-report=term-missing",
    "--cov-report=html",
    "--cov-fail-under=80",
    "-ra",
]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
{% endif %}